import { Component, OnInit } from '@angular/core';
import { WaitTasksService } from 'src/app/wait-manage/wait-tasks/wait-tasks.service';
import { Router } from "@angular/router"
@Component({
  selector: 'app-home',
  templateUrl: './home.component.html',
  styleUrls: ['./home.component.scss']
})
export class HomeComponent implements OnInit {
  tabs = [];
  divCount = [];
  selectedId: any;
  constructor(
    private waitTaskService: WaitTasksService,
    private router : Router
    ) { }
  ngOnInit(): void {
    this.selectedId = "";
    this.GetBtnList();
    this.GetDivList("");
  }
  GetDivData(obj): void {
    this.selectedId = obj;
    this.GetDivList(obj);
  }
  GetDivList(obj): void {
    let data = {
    }
    this.waitTaskService.GetTodos(data,obj).subscribe(res => {
    this.divCount=res;
    });
  }
  GetBtnList(): void {
    this.waitTaskService.GetDict().subscribe(res => {
      this.tabs=res;
    });
  }

  ViewData(obj):void
  {
    console.log(obj);
    this.router.navigate([obj.link]);
    // this.router.navigate(obj.link);
  }
}
